﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MyPSDALayer;
using MyPS.Models;

namespace MyPS.Controllers
{
    public class TopTeamController : Controller
    {
        MyPSEntities db = new MyPSEntities();
        //
        // GET: /TopTeam/

        public ActionResult Index()
        {
            var mode = db.TopTeams.Where(o => o.ISIndex == "Y").Take(7).Select(o => new V_Name_ID { ID = o.ID, Name = o.TeamName }).ToList();
            ViewBag.TeamList = mode;
            return View();
        }

        public ActionResult Details(int id = 0)
        {
            var mode = db.TopTeams.Find(id);
            if (mode == null)
            {
                return HttpNotFound();
            }
            var teamList = db.TopTeams.Where(o => o.ISIndex == "Y").Take(7).Select(o => new V_Name_ID { ID = o.ID, Name = o.TeamName }).ToList();
            ViewBag.TeamList = teamList;
            return View(mode);
        }

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }

    }
}
